{template 'member', 'header'}
<div class="layui-forget">
	<div class="layui-title"><h2>通过用户名找回</h2></div>
	{if $step==1}
	<form method="post" action="" id="myform" class="layui-form layui-form-pane">
    	<div class="layui-form-item">
			<label class="layui-form-label">用户</label>
			<div class="layui-input-block">
				<input type="text" id="username" name="username" lay-verify="required" autocomplete="off" placeholder="请输入用户名" class="layui-input" style="width: 170px;">
			</div>
		</div>
        <div class="layui-form-item">
			<label class="layui-form-label">验证码</label>
			<div class="layui-input-block">
				<input type="text" id="code" name="code" autocomplete="off" lay-verify="required" placeholder="验证码" class="layui-input" style="width: 74px;">{form::checkcode('code_img', '4', '12', 60, 26)}
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;">
				<input type="hidden" name="step" value="2">
				<input type="submit" name="dosubmit" id="dosubmit" class="layui-btn" lay-submit="" lay-filter="dosubmit" value="{L('submit')}">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;text-align: right;">
				<a href="{APP_PATH}index.php?m=member&c=index&a=public_get_password_type">重新选择验证方式！</a>
			</div>
		</div>
	</form>
	{elseif $step==2}
	<form method="post" action="" id="myform" class="layui-form layui-form-pane">
    	<div class="layui-form-item">
			<label class="layui-form-label">绑定邮箱为</label>
			<div class="layui-input-block">
				 <input type="hidden" name="step" value="3">
				<input type="text" id="username" name="username" autocomplete="off" class="layui-input" style="width: 170px;" value="{substr($r['email'],0,3)}****@{$email_arr[1]}">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;text-align: right;">
				<a id="mobile_div" class="layui-btn">点击获取邮箱校验码</a>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;text-align: text;">
				<p class="layui-text" id="mobile_send" style="display:none">重邮箱校验码已发送成功，请查收，请在5分钟内完成验证！</p>
			</div>
		</div>
    	<div class="layui-form-item">
			<label class="layui-form-label">邮箱校验码</label>
			<div class="layui-input-block">
				<input type="text" name="email_verify" id="email_verify" lay-verify="required" autocomplete="off" placeholder="请输入用户名" class="layui-input" style="width: 170px;">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;">
				<input type="submit" name="dosubmit" id="dosubmit" class="layui-btn" lay-submit="" lay-filter="dosubmit" value="{L('submit')}">
			</div>
		</div>
	</form>
	{else}
	<div class="layui-form">
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;text-align: text;">
				<p class="layui-text">步骤：1. 用户名确认</p>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;text-align: text;">
				<p class="layui-text">2. 邮箱地址确认</p>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;text-align: text;">
				<p class="layui-text">3. 重置密码成功</p>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-inline" style="width:100%;text-align: text;">
				<p class="layui-text">您的新密码为：{$password}</p>
			</div>
		</div>	
	</div>		
	{/if}
</div>
<script>
layui.use(['form','layer'], function(){
  var form = layui.form
  ,layer = layui.layer;
});
layui.use('jquery', function(){
	var $ = layui.jquery;
	$('#mobile_div').click(function(){
		$.get("?m=member&c=index&a=public_get_email_verify",{ session_code: '{$_SESSION['code']}',random:Math.random()}, function(data){
			if(data=="1") {
				$("#mobile_div").hide();
				$("#mobile_send").show();
			}
		});
	});
});
</script>
{template 'member', 'footer'}